package com.chijun.mform.create.mode;

import androidx.annotation.IntDef;
import androidx.annotation.IntRange;

import com.chijun.mform.FormBuilder;
import com.example.ccj.u.sqlite.TableName;

import java.util.Collection;

/**
 * 表单字段
 */
@TableName(FormBuilder.TABLE_FORM_FIELD_NAME)
public class FormField implements Comparable<FormField> {
    public static final int FORM_ID = 0;           //表单编号
    public static final int TEXT_ONE = 1;           //单行文字
    public static final int TEXT_MULTI = 2;         //多行文字
    public static final int DAN_XUAN = 3;           //单项选择
    public static final int DUO_XUAN = 4;           //多项选择
    public static final int SHU_ZI = 5;             //数字
    public static final int RI_QI = 6;              //日期
    public static final int RI_QI_QU_JIAN = 7;      //日期区间
    public static final int SHUO_MING_WEN_ZI = 8;   //说明文字
    public static final int SHEN_FEN_ZHENG = 9;     //身份证
    public static final int TU_PIAN = 10;           //图片
    public static final int JIN_E = 11;             //金额
    public static final int FU_JIAN = 12;           //附件
    public static final int JING_WEI_DU = 13;       //经纬度
    public static final int JI_SUAN_GONG_SHI = 14;  //计算公式
    public static final int LIAN_XI_REN = 15;       //联系人
    public static final int SHOU_XIE = 16;          //手写
    public static final int GUAN_LIAN_BIAO_DAN = 17;//关联表单
    public static final int ER_WEI_MA = 18;            //扫码

    @IntDef({FORM_ID,TEXT_ONE,TEXT_MULTI,DAN_XUAN,DUO_XUAN,SHU_ZI,RI_QI,RI_QI_QU_JIAN
            ,SHUO_MING_WEN_ZI,SHEN_FEN_ZHENG,TU_PIAN,JIN_E,FU_JIAN,JING_WEI_DU
            ,JI_SUAN_GONG_SHI,LIAN_XI_REN,SHOU_XIE,GUAN_LIAN_BIAO_DAN,ER_WEI_MA})
    public @interface FieldType{ }


    public FormField(){}


    //字段id
    private long id;
    //字段所属表单id
    private long formId;
    //字段名称
    private String name;
    //字段加载序号
    private int orderColumn;
    //字段类型
    private @FieldType int type;
    //字段提示
    private String hint;
    //单位
    private String company;
    //默认填写内容
    private String defaultContent;
    //文本颜色
    private int textColor = -16777216;
    //是否必填
    private boolean isMast = false;
    //是否必须拍照，
    private boolean isMastShoot = false;
    //是否关联选项
    private boolean isAss = false;
    //小数位数
    private int littleNum = 2;
    //是否扫码
    private boolean canScanCode = false;
    //是否只读
    private boolean isReadOnly = false;
    //是否参与打印
    private boolean isPrint = true;
    private boolean isShowBig = true;
    private String timeType;

    private int permission = 0;
    private boolean isShow = false;






    @Override
    public String toString() {
        return "FormField{" +
                "id=" + id +
                ", formId=" + formId +
                ", name='" + name + '\'' +
                ", order=" + orderColumn +
                ", type=" + type +
                ", hint='" + hint + '\'' +
                ", company='" + company + '\'' +
                ", defaultContent='" + defaultContent + '\'' +
                ", textColor=" + textColor +
                ", isMast=" + isMast +
                ", isMastShoot=" + isMastShoot +
                ", isAss=" + isAss +
                ", littleNum=" + littleNum +
                ", canScanCode=" + canScanCode +
                ", isReadOnly=" + isReadOnly +
                ", isPrint=" + isPrint +
                '}';
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getFormId() {
        return formId;
    }

    public void setFormId(long formId) {
        this.formId = formId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getOrderColumn() {
        return orderColumn;
    }

    public void setOrderColumn(int orderColumn) {
        this.orderColumn = orderColumn;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getHint() {
        return hint;
    }

    public void setHint(String hint) {
        this.hint = hint;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getDefaultContent() {
        return defaultContent;
    }

    public void setDefaultContent(String defaultContent) {
        this.defaultContent = defaultContent;
    }

    public int getTextColor() {
        return textColor;
    }

    public void setTextColor(int textColor) {
        this.textColor = textColor;
    }

    public boolean isMast() {
        return isMast;
    }

    public void setMast(boolean mast) {
        isMast = mast;
    }

    public boolean isMastShoot() {
        return isMastShoot;
    }

    public void setMastShoot(boolean mastShoot) {
        isMastShoot = mastShoot;
    }

    public boolean isAss() {
        return isAss;
    }

    public void setAss(boolean ass) {
        isAss = ass;
    }

    public int getLittleNum() {
        return littleNum;
    }

    public void setLittleNum(int littleNum) {
        this.littleNum = littleNum;
    }

    public boolean isCanScanCode() {
        return canScanCode;
    }

    public void setCanScanCode(boolean canScanCode) {
        this.canScanCode = canScanCode;
    }

    public boolean isReadOnly() {
        return isReadOnly;
    }

    public void setReadOnly(boolean readOnly) {
        isReadOnly = readOnly;
    }

    public boolean isPrint() {
        return isPrint;
    }

    public void setPrint(boolean print) {
        isPrint = print;
    }

    public boolean isShowBig() {
        return isShowBig;
    }

    public void setShowBig(boolean showBig) {
        isShowBig = showBig;
    }

    public String getTimeType() {
        return timeType;
    }

    public void setTimeType(String timeType) {
        this.timeType = timeType;
    }

    public int getPermission() {
        return permission;
    }

    public void setPermission(int permission) {
        this.permission = permission;
    }

    @Override
    public int compareTo(FormField o) {
        return this.orderColumn - o.orderColumn;
    }

    public boolean isShow() {
        return isShow;
    }

    public void setShow(boolean show) {
        isShow = show;
    }
}
